<?php
/*
 * name: gsl
 * desc: 短信验证码 迁移表
 * date: 2018/09/21
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateSmsCodeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sms_code', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string('phone',15)->comment('手机号');
            $table->string('code',10)->comment('验证码');
            $table->integer('over_time')->comment('过期时间');
            $table->tinyInteger('type')->default(1)->comment('短信类型，1注册, 2登录, 3忘记密码, 4修改密码, 5改绑手机号');
            $table->tinyInteger('status')->default(1)->comment('验证状态，1未验证, 2已验证');
            $table->timestamps();
            // $table->softDeletes();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."sms_code` comment'短信验证码'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sms_code');
    }
}
